﻿using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;

namespace Ics.NuttxSharp
{
    public static class EmbedLibrary
    {
        public enum QueueState
        {
            QueueState_Empty,
            QueueState_Full,
            QueueState_OK,
            QueueState_Timeout,
        }

        //EL_WAIT_FOREVER
        public const uint EL_WAIT_FOREVER = 0xFFFFFFFF;

        //El_Queue_t:IntPtr
        //El_Queue_t El_CreateQueue(const char* queueName, uint32_t queueItemSize, uint32_t maxItemLen);
        [DllImport("*")]
        public static extern IntPtr El_CreateQueue(string queueName, uint itemSize, uint maxItemLen);

        //void El_DeleteQueue(El_Queue_t);
        [DllImport("*")]
        public static extern void El_DeleteQueue(IntPtr queue);

        //QueueState El_ReceiveQueue(El_Queue_t queue, void* item, uint32_t itemSize, uint32_t timeout, int isIsr);
        [DllImport("*")]
        public static extern QueueState El_ReceiveQueue(IntPtr queue, IntPtr item, uint itemSize, uint timeout, int isIsr);

        //QueueState El_SendQueue(El_Queue_t queue, void* item, uint32_t itemSize, int isIsr);
        [DllImport("*")]
        public static extern QueueState El_SendQueue(IntPtr queue, IntPtr item, uint itemSize, int isIsr);

        //void El_ResetQueue(El_Queue_t queue, int isIsr);
        [DllImport("*")]
        public static extern void El_ResetQueue(IntPtr queue, int isIsr);

        //uint32_t El_QueueSpacesAvailable(El_Queue_t queue, int isIsr);
        [DllImport("*")]
        public static extern uint El_QueueSpacesAvailable(IntPtr queue, int isIsr);
    }
}
